home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
extlib20.arc
/
EXTLIB.DOC
next >
Wrap
Text File
|
1990-03-09
|
176KB
|
6,205 lines
EXTENDED LIBRARY
Version 2.0
Reference Manual
Distributed By
Maine Data and Financial Systems, Inc.
HCR 79 Box 103
Orland, ME 04472
(207) 469-7027
Copyright (c) 1988, 1989, 1990 By MDFS, Inc.
License Agreement
License Agreement
The Extended Library is protected by United States Copyright Law
and International Treaty provisions. All rights are reserved.
Non-registered users of Extended Library are licensed only to use
the program on a trial basis for the sole purpose of determining
whether or not it meets their requirements. All other use requires
registration.
Any other use of non-registered copies of Extended Library by any
person, business, corporation, government organization, or any
other entity is strictly forbidden and is a violation of this
license agreement.
Registration permits a user license to use Extended Library on a
single computer.
All users are granted a limited license to copy Extended Library
for the trial use of others, with the following additional
conditions:
Extended Library must be distributed in unmodified,
complete form, including this Reference Manual and
License Agreement.
Extended Library may not be distributed in conjunction
with any other product, without permission of Maine Data
and Financial Systems, Inc.
No fee, other than a bonafide disk duplicating fee, not
to exceed $6.00 per disk, may be charged for Extended
Library.
Maine Data and Financial Systems, Inc. grants, to registered owners
only, a royalty-free right to reproduce and distribute the runtime
routines provided they are distributed only in conjunction with and
as part of a software product.
i
Warranty
Warranty
Maine Data and Financial Systems, Inc. makes no warranty of any
kind, express or implied, including without limitation, any
warranties of merchantability and/or fitness for a particular
purpose. Maine Data and Financial Systems, Inc. shall not be held
liable for any damages, whether direct, indirect, special or
consequential arising from a failure of this program to operate in
the manner desired by the user. Maine Data and Financial Systems,
Inc. shall not be held liable for any damage to data or property
which may be caused directly or indirectly by the use of this
program.
In no event will Maine Data and Financial Systems, Inc. be held
liable for any damages, including (but not limited to) any lost
profits, lost savings or other incidental or consequential damages
arising out of the use or inability to use this program, or for any
claim by any other party.
This warranty is governed by the laws of the State of Maine.
ii
Table of Contents
Table of Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 1
Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Global Variables . . . . . . . . . . . . . . . . . . . . . . . 3
center_button . . . . . . . . . . . . . . . . . . . . . . 3
left_button . . . . . . . . . . . . . . . . . . . . . . . 3
menu_att . . . . . . . . . . . . . . . . . . . . . . . . . 3
menu_highlight . . . . . . . . . . . . . . . . . . . . . . 4
menu_hotkey . . . . . . . . . . . . . . . . . . . . . . . 4
mouse_row . . . . . . . . . . . . . . . . . . . . . . . . 4
mouse_col . . . . . . . . . . . . . . . . . . . . . . . . 4
nonibm . . . . . . . . . . . . . . . . . . . . . . . . . . 5
right_button . . . . . . . . . . . . . . . . . . . . . . . 5
Standard Data Types . . . . . . . . . . . . . . . . . . . . . . 6
boolean . . . . . . . . . . . . . . . . . . . . . . . . . 6
DATE . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
MENU . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
MENU_HEAD . . . . . . . . . . . . . . . . . . . . . . . . 8
PHONE . . . . . . . . . . . . . . . . . . . . . . . . . . 9
SSN . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 11
clearcolumn . . . . . . . . . . . . . . . . . . . . . . 12
clearone . . . . . . . . . . . . . . . . . . . . . . . . 13
clearrow . . . . . . . . . . . . . . . . . . . . . . . . 14
clearscreen . . . . . . . . . . . . . . . . . . . . . . 15
cursoroff . . . . . . . . . . . . . . . . . . . . . . . 16
cursoron . . . . . . . . . . . . . . . . . . . . . . . . 16
date_string . . . . . . . . . . . . . . . . . . . . . . 17
dialog . . . . . . . . . . . . . . . . . . . . . . . . . 18
display_date . . . . . . . . . . . . . . . . . . . . . . 20
display_dollar . . . . . . . . . . . . . . . . . . . . . 21
display_number . . . . . . . . . . . . . . . . . . . . . 22
display_phone . . . . . . . . . . . . . . . . . . . . . 23
display_ssn . . . . . . . . . . . . . . . . . . . . . . 24
display_string . . . . . . . . . . . . . . . . . . . . . 25
drawborder . . . . . . . . . . . . . . . . . . . . . . . 26
fillcolumn . . . . . . . . . . . . . . . . . . . . . . . 27
fillone . . . . . . . . . . . . . . . . . . . . . . . . 28
fillrow . . . . . . . . . . . . . . . . . . . . . . . . 29
fillscreen . . . . . . . . . . . . . . . . . . . . . . . 30
getcurpos . . . . . . . . . . . . . . . . . . . . . . . 31
hidemouse . . . . . . . . . . . . . . . . . . . . . . . 32
hotstring . . . . . . . . . . . . . . . . . . . . . . . 33
input_date . . . . . . . . . . . . . . . . . . . . . . . 34
iii
Table of Contents
input_dollar . . . . . . . . . . . . . . . . . . . . . . 36
input_number . . . . . . . . . . . . . . . . . . . . . . 37
input_phone . . . . . . . . . . . . . . . . . . . . . . 38
input_ssn . . . . . . . . . . . . . . . . . . . . . . . 40
input_string . . . . . . . . . . . . . . . . . . . . . . 42
keypressed . . . . . . . . . . . . . . . . . . . . . . . 43
movescreen . . . . . . . . . . . . . . . . . . . . . . . 44
phone_string . . . . . . . . . . . . . . . . . . . . . . 45
popup . . . . . . . . . . . . . . . . . . . . . . . . . 46
printcenter . . . . . . . . . . . . . . . . . . . . . . 48
printone . . . . . . . . . . . . . . . . . . . . . . . . 49
printstring . . . . . . . . . . . . . . . . . . . . . . 50
pulldown . . . . . . . . . . . . . . . . . . . . . . . . 51
pulldown_bar . . . . . . . . . . . . . . . . . . . . . . 57
readmouse . . . . . . . . . . . . . . . . . . . . . . . 58
resetmouse . . . . . . . . . . . . . . . . . . . . . . . 59
restorescreen . . . . . . . . . . . . . . . . . . . . . 60
save_initial_video . . . . . . . . . . . . . . . . . . . 61
savescreen . . . . . . . . . . . . . . . . . . . . . . . 62
setattrib . . . . . . . . . . . . . . . . . . . . . . . 63
setcurpos . . . . . . . . . . . . . . . . . . . . . . . 64
setcursor . . . . . . . . . . . . . . . . . . . . . . . 65
setone . . . . . . . . . . . . . . . . . . . . . . . . . 66
settext80 . . . . . . . . . . . . . . . . . . . . . . . 67
showmouse . . . . . . . . . . . . . . . . . . . . . . . 68
ssn_string . . . . . . . . . . . . . . . . . . . . . . . 69
w_close . . . . . . . . . . . . . . . . . . . . . . . . 70
w_clreol . . . . . . . . . . . . . . . . . . . . . . . . 71
w_cls . . . . . . . . . . . . . . . . . . . . . . . . . 72
w_draw . . . . . . . . . . . . . . . . . . . . . . . . . 73
w_horizontal_bar . . . . . . . . . . . . . . . . . . . . 74
w_open . . . . . . . . . . . . . . . . . . . . . . . . . 75
w_print . . . . . . . . . . . . . . . . . . . . . . . . 77
w_printat . . . . . . . . . . . . . . . . . . . . . . . 78
w_printf . . . . . . . . . . . . . . . . . . . . . . . . 79
w_println . . . . . . . . . . . . . . . . . . . . . . . 80
w_printlnat . . . . . . . . . . . . . . . . . . . . . . 81
w_scroll . . . . . . . . . . . . . . . . . . . . . . . . 82
w_setcurpos . . . . . . . . . . . . . . . . . . . . . . 84
w_vertical_bar . . . . . . . . . . . . . . . . . . . . . 85
waitkey . . . . . . . . . . . . . . . . . . . . . . . . 86
wprintf . . . . . . . . . . . . . . . . . . . . . . . . 87
Registration . . . . . . . . . . . . . . . . . . . . . . . . 88
iv
Introduction
Introduction
Extended Library is an extensive library of C runtime routines that
allow easy program implementation of many of today's advanced user
interface techniques. Some of Extended Library's features include
dynamic display screen windows, pull-down menus, pop-up menus,
dialog box menus, horizontal and vertical scroll bars, reading from
and writing to display memory without interference, formatted
display input/output routines, and a wide variety of cursor control
routines. Furthermore, the Extended Library routines fully support
a Microsoft compatible mouse.
The Extended Library routines are written in both assembly language
and C and can be used with Turbo C, Microsoft C, Microsoft QuickC,
and Lattice C. The Extended Library supports the small, medium,
compact, and large memory models. (Note: Only the small memory
model version of Extended Library is included with the shareware
version.)
Lattice C is a trademark of Lattice, Inc.
Microsoft is a registered trademark and QuickC is a trademark of
the Microsoft Corporation.
Turbo C is a trademark of Borland International, Inc.
1 1
Libraries
Libraries
Although Extended Library is really only one set of library
routines, C's support of the various memory models requires a
separate version of the library for each memory model. The
following is a list of the various versions of Extended Library:
===================================================================
Compiler Small Medium Compact Large
Model Model Model Model
-------------------------------------------------------------------
TC TEXTLIBS.LIB TEXTLIBM.LIB TEXTLIBC.LIB TEXTLIBL.LIB
MCS MEXTLIBS.LIB MEXTLIBM.LIB MEXTLIBC.LIB MEXTLIBL.LIB
QC QEXTLIBS.LIB QEXTLIBM.LIB QEXTLIBC.LIB QEXTLIBL.LIB
LC LEXTLIBS.LIB LEXTLIBP.LIB LEXTLIBD.LIB LEXTLIBL.LIB
===================================================================
2 2
Global Variables
Global Variables
The Extended Library defines a number of variables in the extlib.h
header file. Through proper use, these variables allow the
programmer to customize the Extended Library functions to meet
particular application program's needs.
center_button
-------------------------------------------------------------------
Defined As: int center_button;
Description: After a call to the readmouse function, the
center_button variable holds the mouse's center
button status. If the center button is being held
down, center_button will be set to TRUE (1).
Otherwise, center_button will be set to FALSE (0) to
indicate a released center button.
left_button
------------------------------------------------------------------
Defined As: int left_button;
Description: After a call to the readmouse function, the
left_button variable holds the mouse's left button
status. If the left button is being held down,
left_button will be set to TRUE (1). Otherwise,
left_button will be set to FALSE (0) to indicate a
released left button.
menu_att
------------------------------------------------------------------
Defined As: int menu_att;
Description: The menu_att variable is used by Extended Library as
the default display attribute for the dialog box,
pop-up, and pull-down menu functions. Initially,
menu_att is set to a value of 0x70 (black characters
on a white background). However, the menu_att
variable can be changed to suit a particular
application program's needs.
3 3
Global Variables
menu_highlight
-------------------------------------------------------------------
Defined As: int menu_highlight;
Description: The menu_highlight variable is used by Extended
Library as the default display attribute for
highlighting menu selections. Initially,
menu_highlight is set to a value of 0x07 (white
characters on a black background). However, the
menu_highlight variable can be changed to suit a
particular application program's needs.
menu_hotkey
-------------------------------------------------------------------
Defined As: int menu_hotkey;
Description: The menu_hotkey variable is used by Extended Library
as the default display attribute for menu item
hotkeys. Initially, menu_hotkey is set to a value
of 0x7f (intense white characters on a white
background). However, the menu_hotkey variable can
be changed to suit a particular application
program's needs.
mouse_row
-------------------------------------------------------------------
Defined As: int mouse_row;
Description: After a call to the readmouse function, the
mouse_row variable holds the mouse pointer's row
coordinate.
mouse_col
-------------------------------------------------------------------
Defined As: int mouse_col;
Description: After a call to the readmouse function, the
mouse_col variable holds the mouse pointer's column
coordinate.
4 4
Global Variables
nonibm
-------------------------------------------------------------------
Defined As: int nonibm;
Description: The nonibm variable is used by Extended Library to
eliminate snow on an IBM CGA. When it is called,
the settext80 function determines the current
display adapter's type. If a CGA is present,
settext80 sets nonibm to FALSE (0). If an MDA, EGA,
or VGA is present, settext80 sets the nonibm
variable to TRUE (1). If the current display
adapter is a non-IBM CGA, it is the program's
responsibility to manually set the nonibm variable
to TRUE. Although this is strictly optional,
manually setting the nonibm variable will speed up
display input/output.
right_button
-------------------------------------------------------------------
Defined As: int right_button
Description: After a call to the readmouse function, the
right_button variable holds the mouse's right button
status. If the right button is being held down,
right_button will be set to TRUE (1). Otherwise,
right_button will be set to FALSE (0) to indicate a
released right button.
5 5
Standard Data Types
Standard Data Types
In extlib.h, Extended Library defines a number of useful data
types.
boolean
-------------------------------------------------------------------
Defined As: typedef int boolean;
Description: The boolean data type is used to define logical
variables. To assist in the use of the boolean data
type, the following two constants are defined in
extlib.h:
====================================================
Constant Value
----------------------------------------------------
TRUE 1
FALSE 0
====================================================
DATE
-------------------------------------------------------------------
Defined As: typedef struct {
int month, day, year;
} DATE;
Description: The DATE structure is used to define dates for the
date_string, display_date, and input_date functions.
The DATE structure is used as follows:
====================================================
Data Type Description
----------------------------------------------------
month The date's month.
day The date's day of the
month.
year The date's year.
====================================================
6 6
Standard Data Types
MENU
-------------------------------------------------------------------
Defined As: typedef struct {
char *string;
int hotkey;
void (*function)(void);
void (*help)(void);
} MENU;
Description: The MENU structure is used to define menu items for
the Extended Library menu functions. The MENU
structure is used as follows:
====================================================
Data Type Description
----------------------------------------------------
string Pointer to a string, which
defines the menu item.
hotkey Position in string of the
menu item's hotkey
character.
(*function)() Pointer to a function,
which is executed if the
menu item is selected.
(*help)() Pointer to a function,
which is executed if help
is requested for the
highlighted menu item.
====================================================
7 7
Standard Data Types
MENU_HEAD
-------------------------------------------------------------------
Defined As: typedef struct {
char *heading;
int hotkey, number;
MENU *mptr;
} MENU_HEAD;
Description: The MENU_HEAD structure is used to define menus for
the Extended Library's pull-down menu functions.
The MENU_HEAD structure is used as follows:
====================================================
Data Type Description
----------------------------------------------------
heading Pointer to a string, which
defines the menu's heading.
hotkey Position in heading of the
menu's pull-down hotkey
character.
number Number of items in the
pull-down menu.
mptr Pointer to an array of MENU
structures, which defines
the pull-down menu.
====================================================
8 8
Standard Data Types
PHONE
-------------------------------------------------------------------
Defined As: typedef struct {
int area, exchange, no;
} PHONE;
Description: The PHONE structure is used to define phone numbers
for the display_phone, input_phone, and phone_string
functions. The PHONE structure is used as follows:
====================================================
Data Type Description
----------------------------------------------------
area The phone number's area
code.
exchange The phone number's
exchange.
no The phone number's final
four digits.
====================================================
9 9
Standard Data Types
SSN
-------------------------------------------------------------------
Defined As: typedef struct {
int no1, no2, no3;
} SSN;
Description: The SSN structure is used to define Social Security
numbers for the display_ssn, input_ssn, and
ssn_string functions. The SSN structure is used as
follows:
====================================================
Data Type Description
----------------------------------------------------
no1 The Social Security
number's first three
digits.
no2 The Social Security
number's middle two digits.
no3 The Social Security
number's final four digits.
====================================================
10 10
Functions
Functions
The Extended Library contains a wide variety of functions. To
facilitate their use in application programs, this section
describes the Extended Library functions as follows:
Summary: Presents an exact syntactic model for each of the
Extended Library functions.
Description: Describes a function's purpose and how it is used in
an application program.
Return Value: Explains any of the possible return values for an
Extended Library function.
See Also: Lists any similar or related Extended Library
function.
Example: Illustrates how an Extended Library function could
actually be used in an application program.
11 11
Functions
clearcolumn
-------------------------------------------------------------------
Summary: #include "extlib.h"
void clearcolumn(row1, col, row2, att);
int row1; (starting row)
int col; (column)
int row2; (ending row)
int att; (attribute)
Description: The clearcolumn macro clears a display screen column
starting at the coordinate defined by (row1, col)
and ending with the coordinate defined by (row2,
col). Additionally, the column's attributes will be
set to (att).
Return Value: No value is returned.
See Also: clearone, clearrow, and clearscreen
Example: The following program clears the display screen's
first column.
/* clearcolumn demo */
#include "extlib.h"
main()
{
save_initial_video();
clearcolumn(1, 1, 25, 0x17);
waitkey();
}
12 12
Functions
clearone
-------------------------------------------------------------------
Summary: #include "extlib.h"
void clearone(row, col, att);
int row, col; (screen position)
int att; (attribute)
Description: The clearone macro clears the display screen
position defined by (row, col). Additionally, the
position's attribute is set to (att).
Return Value: No value is returned.
See Also: clearcolumn, clearrow, and clearscreen
Example: The following program demonstrates the clearone
macro by erasing the character at display screen
position 10, 40.
/* clearone demo */
#include "extlib.h"
main()
{
save_initial_video();
clearone(10, 40, 0x17);
waitkey();
}
13 13
Functions
clearrow
-------------------------------------------------------------------
Summary: #include "extlib.h"
void clearrow(row, col1, col2, att);
int row; (row)
int col1; (starting column)
int col2; (ending column)
int att; (attribute)
Description: The clearrow macro clears a display screen row
starting at the coordinate defined by (row, col1)
and ending with the coordinate defined by (row,
col2). Additionally, the row's attributes will be
set to (att).
Return Value: No value is returned.
See Also: clearcolumn, clearone, and clearscreen
Example: The following program demonstrates the clearrow
macro by erasing the top line of the display screen.
/* clearrow demo */
#include "extlib.h"
main()
{
save_initial_video();
clearrow(1, 1, 80, 0x17);
waitkey();
}
14 14
Functions
clearscreen
-------------------------------------------------------------------
Summary: #include "extlib.h"
void clearscreen(row1, col1, row2, col2, att);
int row1, col1; (Upper left corner of the
text window)
int row2, col2; (Lower right corner of the
text window)
int att; (text window attribute)
Description: The clearscreen macro clears an area of the display
screen defined by the coordinates (row1, col1) and
(row2, col2). Additionally, the cleared text
window's attributes are set to att.
Return Value: No value is returned.
See Also: clearcolumn, clearone, and clearrow
Example: The following program demonstrates the clearscreen
macro by clearing the display screen.
/* clearscreen demo */
#include "extlib.h"
main()
{
save_initial_video();
clearscreen(1, 1, 25, 80, 0x17);
waitkey();
}
15 15
Functions
cursoroff,cursoron
-------------------------------------------------------------------
Summary: #include "extlib.h"
void cursoroff(void);
void cursoron(void);
Description: The cursoroff function turns the cursor off. The
cursoron function turns the cursor on.
Return Value: No value is returned.
Example: The following program demonstrates the cursoroff and
cursoron functions by first turning the cursor off
and then turning the cursor back on again.
/* cursoroff/cursoron demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
settext80();
clearscreen(1, 1, 25, 80, 7);
cursoroff();
printstring(1, 1, "Press a key to turn the
cursor back on.....");
waitkey();
cursoron();
exit(0);
}
16 16
Functions
date_string
-------------------------------------------------------------------
Summary: #include "extlib.h"
char *date_string(string, date);
char *string; (storage location for the
date string)
DATE *date; (date structure)
Description: The date_string function constructs an eight-
character date string (string = "mm/dd/yy") for the
date defined by (date).
Return Value: The date_string function returns a pointer to the
resulting date string.
See Also: display_date and input_date
Example: The following program demonstrates the date_string
function by displaying a constructed date string at
the upper left corner of the video display.
/* date_string */
#include <stdlib.h>
#include "extlib.h"
main()
{
static DATE d = {10, 3, 61};
char line[80];
save_initial_video();
printstring(1, 1, date_string(line, &d));
waitkey();
exit(0);
}
17 17
Functions
dialog
-------------------------------------------------------------------
Summary: #include "extlib.h"
int dialog(row, col, nmenus, menu, ESC_flag,
ntitles, [title, ...]);
int row, col; (coordinate to center the
dialog box on)
int nmenus; (number of menu items)
MENU *menu; (pointer to an array of
MENU structures)
int ntitles; (number of titles)
char *title; (title pointer)
Description: The dialog function displays a dialog box menu
centered at the coordinates defined by (row, col).
If any titles are specified, they are displayed
above the menu items pointed to by (menu). A menu
item can be selected by pressing the indicated
hotkey. Furthermore, the double-lined menu item can
be selected by simply pressing <ENTER>. Help, if
it's available, can be requested for the highlighted
menu item by pressing <F1>. The double-lined
highlighting is moved from one menu item to the next
by pressing either <LEFT ARROW> or <RIGHT ARROW>.
Additionally, the ESC_flag is used to enable or
disable the <ESC> key. If ESC_flag is set to TRUE
(1), the <ESC> key is enabled. Otherwise, the
ESC_flag should be set to FALSE (0) to disable the
<ESC> key.
Return Value: If the menu item has an NULL function pointer, the
dialog function returns the value of the selected
item's hotkey. Otherwise, the dialog function
returns a value of zero. If the <ESC> key is
enabled and <ESC> is pressed, the dialog function
will return a value of 27.
Example: The following program demonstrates the dialog
function by asking whether or not a file should be
saved. If instructed to do so, the dialog function
executes the simulated save file function.
/* dialog demo */
#include <stdio.h>
#include <stdlib.h>
#include "extlib.h"
void save_file(void);
static MENU menu[3] = {
18 18
Functions
{"Yes", 0, save_file, NULL},
{"No", 0, NULL, NULL},
{"Cancel", 0, NULL, NULL} };
void main(void)
{
int key;
save_initial_video();
do {
key = dialog(13, 40, 3, menu, TRUE, 2,
"The file hasn't been saved!",
"Do you want me to save it?");
} while (key != 27 && key != 'C');
exit(0);
}
void save_file(void)
{
printcenter(13, 40, "The file has been saved");
waitkey();
clearscreen(13, 1, 13, 80, 7);
}
19 19
Functions
display_date
-------------------------------------------------------------------
Summary: #include "extlib.h"
void display_date(row, col, date);
int row, col; (screen position)
DATE *date; (date structure)
Description: The display_date function displays a date (date) at
the display screen position defined by (row, col).
Return Value: No value is returned.
See Also: date_string and input_date
Example: The following program demonstrates the display_date
function by displaying a variety of dates on the
display screen.
/* display_date demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
static DATE d1 = {02, 04, 81};
static DATE d2 = {03, 12, 83};
save_initial_video();
display_date(1, 10, &d1);
display_date(1, 20, &d2);
waitkey();
exit(0);
}
20 20
Functions
display_dollar
-------------------------------------------------------------------
Summary: #include "extlib.h"
void display_dollar(row, col, length, dollar);
int row, col; (screen position)
int length; (field length)
double *dollar; (dollar value)
Description: The display_dollar function displays a right-
justified dollar value (dollar) with a field length
of (length) at the display screen position defined
by (row, col).
Return Value: No value is returned.
See Also: input_dollar
Example: The following program demonstrates the
display_dollar function by displaying a variety of
dollar values on the display screen.
/* display_dollar demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
double n1 = 32.376, n2 = -55.23;
save_initial_video();
display_dollar(1, 1, 10, &n1);
display_dollar(1, 40, 10, &n2);
waitkey();
exit(0);
}
21 21
Functions
display_number
-------------------------------------------------------------------
Summary: #include "extlib.h"
void display_number(row, col, length, number);
int row, col; (screen position)
int length; (field length)
unsigned long *number; (numeric value)
Description: The display_number function displays a right-
justified, unsigned numeric value (number) with a
field length of (length) at the display screen
position defined by (row, col).
Return Value: No value if returned.
See Also: input_number
Example: The following program demonstrates the
display_number function by displaying a variety of
numeric values on the display screen.
/* display_number demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
unsigned long n1 = 456789, n2 = 6789999;
save_initial_video();
display_number(1, 1, 10, &n1);
display_number(1, 40, 10, &n2);
waitkey();
exit(0);
}
22 22
Functions
display_phone
-------------------------------------------------------------------
Summary: #include "extlib.h"
void display_phone(row, col, number);
int row, col; (screen position)
PHONE *number; (phone number structure)
Description: The display_phone function displays a phone number
(number) at the display screen position defined by
(row, col).
Return Value: No value is returned.
See Also: input_phone and phone_string
Example: The following program demonstrates the display_phone
function by displaying an assortment of phone
numbers on the display screen.
/* display_phone demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
static PHONE pn1 = {800, 555, 6678};
static PHONE pn2 = {207, 555, 3277};
save_initial_video();
display_phone(1, 1, &pn1);
display_phone(1, 40, &pn2);
waitkey();
exit(0);
}
23 23
Functions
display_ssn
-------------------------------------------------------------------
Summary: #include "extlib.h"
void display_ssn(row, col, number);
int row, col; (screen position)
SSN *number; (Social Security number
structure)
Description: The display_ssn function displays a Social Security
number (number) at the display screen position
defined by (row, col).
Return Value: No value is returned.
See Also: input_ssn and ssn_string
Example: The following program demonstrates the display_ssn
function by displaying an assortment of Social
Security numbers on the display screen.
/* display_ssn demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
static SSN sn1 = {007, 25, 5687};
static SSN sn2 = {101, 55, 3535};
save_initial_video();
display_ssn(1, 1, &sn1);
display_ssn(1, 40, &sn2);
waitkey();
exit(0);
}
24 24
Functions
display_string
-------------------------------------------------------------------
Summary: #include "extlib.h"
void display_string(row, col, length, string);
int row, col; (screen position)
int length; (field length);
char *string; (string pointer);
Description: The display_string function displays a left-
justified alphanumeric string (string) with a field
length of (length) at the display screen position
defined by (row, col).
Return Value: No value is returned.
See Also: input_string
Example: The following program demonstrates the
display_string functions by displaying an assortment
of strings on the display screen.
/* display_string demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
char *s1 = "This is demo string 1";
char *s2 = "This is demo string 2";
save_initial_video();
display_string(1, 1, 25, s1);
display_string(1, 40, 25, s2);
waitkey();
exit(0);
}
25 25
Functions
drawborder
-------------------------------------------------------------------
Summary: #include "extlib.h"
void drawborder(row1, col1, row2, col2, btype, att);
int row1, col1; (upper left corner of the
text window)
int row2, col2; (lower right corner of the
text window)
int btype; (border type flag)
int att; (border attribute)
Description: The drawborder function draws a border around a text
window, whose coordinates are defined by the points
(row1, col1) and (row2, col2). Additionally, the
border's attributes are set to (att).
The (btype) parameter can be one of the following
constants defined in extlib.h:
====================================================
Constant Action
----------------------------------------------------
SINGLE_LINE Draws a single-lined border
around the text window.
DOUBLE_LINE Draws a double-lined border
around the text window.
====================================================
Return Value: No value is returned.
Example: The following program demonstrates the drawborder
function by drawing a double-lined border around the
right half of the display screen.
/* drawborder demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
drawborder(1, 41, 25, 80, DOUBLE_LINE, 0x70);
waitkey();
exit(0);
}
26 26
Functions
fillcolumn
-------------------------------------------------------------------
Summary: #include "extlib.h"
void fillcolumn(row1, col, row2, chr, att);
int row1; (starting row)
int col; (column)
int row2; (ending row)
int chr; (character)
int att; (attribute)
Description: The fillcolumn macro fills a display screen column
starting at the coordinate defined by (row1, col)
and ending with the coordinate defined by (row2,
col) with the specified character/attribute pair
(chr/att).
Return Value: No value is returned.
See Also: fillone, fillrow, and fillscreen
Example: The following program demonstrates the fillcolumn
macro by filling the first display screen column
with Ms.
/* fillcolumn demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
fillcolumn(1, 1, 25, 'M', 0x70);
waitkey();
exit(0);
}
27 27
Functions
fillone
-------------------------------------------------------------------
Summary: #include "extlib.h"
void fillone(row, col, chr, att);
int row, col; (screen position)
int chr; (character)
int att; (attribute)
Description: The fillone function sets the display screen
position defined by (row, col) to the specified
character/attribute pair (chr/att).
Return Value: No value is returned.
See Also: fillcolumn, fillrow, and fillscreen
Example: The following program demonstrates the fillone
function by displaying a black-on-white M at screen
position (1, 40).
/* fillone demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
fillone(1, 40, 'M', 0x70);
waitkey();
exit(0);
}
28 28
Functions
fillrow
-------------------------------------------------------------------
Summary: #include "extlib.h"
void fillrow(row, col1, col2, chr, att);
int row; (row)
int col1; (starting column)
int col2; (ending column)
int chr; (character)
int att; (attribute)
Description: The fillrow macro fills a display screen row
starting at the coordinate defined by (row, col1)
and ending with the coordinate defined by (row,
col2) with the specified character/attribute pair
(chr/att).
Return Value: No value is returned.
See Also: fillcolumn, fillone, and fillscreen
Example: The following program demonstrates the fillrow macro
by filling the top display screen row with M's.
/* fillrow demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
fillrow(1, 1, 80, 'M', 0x70);
waitkey();
exit(0);
}
29 29
Functions
fillscreen
-------------------------------------------------------------------
Summary: #include "extlib.h"
void fillscreen(row1, col1, row2, col2, chr, att);
int row1, col1; (upper left corner of the
text window)
int row2, col2; (lower right corner of the
text window)
int chr; (character)
int att; (attribute)
Description: The fillscreen function fills the text window
defined by the coordinates (row1, col1) and (row2,
col2), with the character/attribute pair specified
by (chr/att).
Return Value: No value is returned.
See Also: fillcolumn, fillone, and fillrow
Example: The following program demonstrates the fillscreen
function by filling the display screen with M's.
/* fillscreen demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
fillscreen(1, 1, 25, 80, 'M', 0x70);
waitkey();
exit(0);
}
30 30
Functions
getcurpos
-------------------------------------------------------------------
Summary: #include "extlib.h"
void getcurpos(row, col, sline, eline);
int *row; (cursor row position)
int *col; (cursor column position)
int *sline; (cursor starting line)
int *eline; (cursor ending line)
Description: The getcurpos function retrieves the cursor values
by returning the cursor's row position in (row), the
cursor's column position in (col), the cursor
character's starting line in (sline), and the cursor
character's ending line in (eline).
Return Value: No value is returned.
Example: The following program demonstrates the getcurpos
function by retrieving and displaying the current
cursor values.
/* getcurpos demo */
#include <stdio.h>
#include <stdlib.h>
#include "extlib.h"
main()
{
int row, col, sline, eline;
settext80();
getcurpos(&row, &col, &sline, &eline);
clearscreen(1, 1, 25, 80, 7);
setcurpos(1, 1);
printf("Row: %2d Column: %2d Starting Line:
%2d Ending Line: %2d\n",
row, col, sline, eline);
waitkey();
exit(0);
}
31 31
Functions
hidemouse
-------------------------------------------------------------------
Summary: #include "extlib.h"
void hidemouse(void);
Description: The hidemouse function turns off the mouse pointer.
Return Value: No value is returned.
See Also: showmouse
Example: The following program demonstrates the hidemouse
function by turning off the mouse pointer.
/* hidemouse demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
waitkey();
hidemouse();
waitkey();
showmouse();
waitkey();
exit(0);
}
32 32
Functions
hotstring
-------------------------------------------------------------------
Summary: #include "extlib.h"
void hotstring(row, col, hotkey, string);
int row, col; (screen position)
int hotkey; (hotkey position)
char *string; (string pointer)
Description: The hotstring function displays a string at the
display screen position defined by (row, col).
Additionally, the string's (hotkey) character's
attribute is set to menu_hotkey.
Return Value: No value is returned.
See Also: menu_hotkey
Example: The following program demonstrates the hotstring
function by displaying a hotstring on the tenth
display screen line.
/* hotstring demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
hotstring(10, 1, 10, "This is a HOTSTRING
test!");
waitkey();
exit(0);
}
33 33
Functions
input_date
-------------------------------------------------------------------
Summary: #include "extlib.h"
int input_date(row, col, date);
int row, col; (screen position)
DATE *date; (data entry field's
contents)
Description: The input_date function displays and inputs an
eight-character date (date = "mm/dd/yy") at the
display screen position defined by (row, col). The
following keys are active during the input_date
function:
====================================================
Control Key Action
----------------------------------------------------
HOME Move to the first character
in the data entry field.
END Move to the last character
in the data entry field.
LEFT ARROW Move to the previous
character in the data entry
field.
RIGHT ARROW Move to the next character
in the data entry field.
====================================================
Return Value: The input_date function returns the value of the
last key pressed.
See Also: date_string and display_date
34 34
Functions
Example: The following program demonstrates the input_date
function by requesting the current date.
/* input_date demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
static DATE d;
save_initial_video();
printstring(10, 1,
"Please Enter Today's Date:");
while (input_date(10, 28, &d) != 27);
exit(0);
}
35 35
Functions
input_dollar
-------------------------------------------------------------------
Summary: #include "extlib.h"
int input_dollar(row, col, length, dollar);
int row, col; (screen position)
int length; (data entry field's length)
double *dollar; (data entry field's
contents)
Description: The input_dollar function displays and inputs a
right-justified dollar value (dollar) with a field
length of (length) at the display screen position
defined by (row, col). The following control keys
are active during the input_dollar function:
====================================================
Control Key Action
----------------------------------------------------
HOME Clear the data entry
field's contents.
BACKSPACE Erase the last digit
entered.
====================================================
Return Value: The input_dollar function returns the value of the
last key pressed.
See Also: display_dollar
Example: The following program demonstrates the input_dollar
function by requesting an account balance.
/* input_dollar demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
double n = 0;
save_initial_video();
printstring(10, 1,
"Please Enter The Account Balance:");
while (input_dollar(10, 35, 10, &n) != 27);
exit(0);
}
36 36
Functions
input_number
-------------------------------------------------------------------
Summary: #include "extlib.h"
int input_number(row, col, length, number);
int row, col; (screen position)
int length; (data entry field's length)
unsigned long *number; (data entry field's
contents)
Description: The input_number function displays and inputs a
right-justified numeric value (number) with a field
length of (length) at the display screen position
defined by (row, col). The following control keys
are active during the input_number function:
====================================================
Control Key Action
----------------------------------------------------
HOME Clear the data entry
field's contents.
BACKSPACE Erase the last digit
entered.
====================================================
Return Value: The input_number function returns the value of the
last key pressed.
See Also: display_number
Example: The following program demonstrates the input_number
function by requesting an account number.
/* input_number demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
unsigned long n = 0;
save_initial_video();
printstring(10, 1,
"Please Enter The Account Number:");
while (input_number(10, 34, 6, &n) != 27);
exit(0);
}
37 37
Functions
input_phone
-------------------------------------------------------------------
Summary: #include "extlib.h"
int input_phone(row, col, number);
int row, col; (screen position)
PHONE *number; (data entry field's
contents)
Description: The input_phone function displays and inputs a 14-
character telephone number (number = "(xxx) xxx-
xxxx") at the display screen position defined by
(row, col). The following keys are active during
the input_phone function:
====================================================
Control Key Action
----------------------------------------------------
HOME Move to the first character
in the data entry field.
END Move to the last character
in the data entry field.
LEFT ARROW Move to the previous
character in the data entry
field.
RIGHT ARROW Move to the next character
in the data entry field.
====================================================
Return Value: The input_phone function returns the value of the
last key pressed.
See Also: display_phone and phone_string
38 38
Functions
Example: The following program demonstrates the input_phone
function by requesting the operator's telephone
number.
/* input_phone demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
static PHONE n;
save_initial_video();
printstring(10, 1,
"Please Enter Your Phone Number:");
while (input_phone(10, 33, &n) != 27);
exit(0);
}
39 39
Functions
input_ssn
-------------------------------------------------------------------
Summary: #include "extlib.h"
int input_ssn(row, col, number);
int row, col; (screen position)
SSN *number; (data entry field's
contents)
Description: The input_ssn function displays and inputs an 11-
character Social Security number (number = "xxx-xx-
xxxx") at the display screen position defined by
(row, col). The following control keys are active
during the input_ssn function:
====================================================
Control Key Action
----------------------------------------------------
HOME Move to the first character
in the data entry field.
END Move to the last character
in the data entry field.
LEFT ARROW Move to the previous
character in the data entry
field.
RIGHT ARROW Move to the next character
in the data entry field.
====================================================
Return Value: The input_ssn function returns the value of the last
key pressed.
See Also: display_ssn and ssn_string
40 40
Functions
Example: The following program demonstrates the input_ssn
function by requesting the operator's Social
Security number.
/* input_ssn demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
static SSN n;
save_initial_video();
printstring(10, 1, "Please Enter Your
Social Security Number:");
while (input_ssn(10, 43, &n) != 27);
exit(0);
}
41 41
Functions
input_string
-------------------------------------------------------------------
Summary: #include "extlib.h"
int input_string(row, col, length, string);
int row, col; (screen position)
int length; (data entry field's length)
char *string; (data entry field's
contents)
Description: The input_string function displays and inputs a
left-justified alphanumeric string (string) with a
field length of (length) at the display screen
position defined by (row, col). The following
control keys are active during the input_string
function:
====================================================
Control Key Action
----------------------------------------------------
HOME Clear the data entry
field's contents.
BACKSPACE Erase the last digit
entered.
====================================================
Return Value: The input_string function returns the value of the
last key pressed.
See Also: display_string
Example: The following program demonstrates the input_string
function by requesting the operator's name.
/* input_string demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
static char string[31];
save_initial_video();
printstring(10, 1,
"Please Enter Your Name:");
while (input_string(10, 25, 30, string) != 27);
exit(0);
}
42 42
Functions
keypressed
-------------------------------------------------------------------
Summary: #include "extlib.h"
int keypressed(void);
Description: The keypressed function checks to see if a key has
been pressed.
Return Value: The keypressed function returns TRUE (1) if a key
has been pressed or FALSE (0) if a key hasn't been
pressed.
See Also: waitkey
Example: The following program demonstrates the keypressed
function by continuously looping until a key has
been pressed.
/* keypressed demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
printstring(1, 1, "Press a key to exit.....");
while (!keypressed()) ;
exit(0);
}
43 43
Functions
movescreen
-------------------------------------------------------------------
Summary: #include "extlib.h"
void movescreen(row1, col1, row2, col2, row3, col3);
int row1, col1; (upper left corner of the
text window)
int row2, col2; (lower right corner of the
text window)
int row3, col3; (upper left corner for the
text window's new location)
Description: The movescreen function moves a text window defined
by the coordinates (row1, col1) and (row2, col2) to
the new position starting at the (row3, col3).
Return Value: No value is returned.
Example: The following program demonstrates the movescreen
function by moving a portion of the display screen
upper left corner to its upper right half.
/* movescreen demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
settext80();
waitkey();
movescreen(1, 1, 10, 25, 1, 41);
waitkey();
exit(0);
}
44 44
Functions
phone_string
-------------------------------------------------------------------
Summary: #include "extlib.h"
char *phone_string(string, number);
char *string; (storage location for the
phone number string)
PHONE *number; (phone number structure)
Description: The phone_string function constructs a 14-character
phone number string (string = "(xxx) xxx-xxxx") for
the phone number defined by (number).
Return Value: The phone_string function returns a pointer to the
resulting phone number string.
See Also: display_phone and input_phone
Example: The following program demonstrates the phone_string
function by displaying a constructed phone number
string on the tenth line of the display screen.
/* phone_string demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
static PHONE n = {207, 555, 3235};
char line[80];
save_initial_video();
printstring(10, 1, phone_string(line, &n));
waitkey();
exit(0);
}
45 45
Functions
popup
-------------------------------------------------------------------
Summary: #include "extlib.h"
int popup(row, col, number, menu, ESC_flag);
int row, col; (screen position)
int number; (number of menu items)
MENU *menu; (pointer to an array of
MENU structures)
int ESC_flag; (ESC key flag)
Description: The popup function displays a pop-up menu at the
display screen coordinates defined by (row, col).
Selection of a menu item is accomplished by pressing
the desired item's indicated hotkey. Furthermore,
the highlighted menu item can be selected by
pressing the <ENTER> key. Help, if it's available,
can be requested for the highlighted menu item by
pressing <F1>. The highlighting can be moved by
pressing the <UP ARROW> or <DOWN ARROW> key.
Return Value: If the pop-up menu's ESC_flag is TRUE (1) and the
<ESC> key is pressed, the popup function returns a
value of 27. Otherwise, the popup function will
return a value of 0.
Example: The following program demonstrates the popup
function by displaying a three-item pop-up menu.
The pop-up menu will be continuously displayed until
the "Exit the Program" menu item is selected by the
operator.
/* popup demo */
#include <stdlib.h>
#include <string.h>
#include "extlib.h"
void save_file(void);
void load_file(void);
void exit_prog(void);
void sf_help(void);
void lf_help(void);
void ep_help(void);
static MENU menu[3] = {
{"Save the File", 0, save_file, sf_help},
{"Load the File", 0, load_file, lf_help},
{"Exit the Program", 0, exit_prog, ep_help} };
void main(void)
{
46 46
Functions
save_initial_video();
while (!popup(3, 30, 3, menu, TRUE)) ;
exit(0);
}
void save_file(void)
{
printcenter(19, 40, "Save File Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void load_file(void)
{
printcenter(19, 40, "Load File Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void exit_prog(void)
{
exit(0);
}
void sf_help(void)
{
printcenter(19, 40, "Save File Help Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void lf_help(void)
{
printcenter(19, 40, "Load File Help Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void ep_help(void)
{
printcenter(19, 40,
"Exit Program Help Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
47 47
Functions
printcenter
-------------------------------------------------------------------
Summary: #include "extlib.h"
void printcenter(row, col, string);
int row; (row)
int col; (column to center the
string on)
char *string; (string pointer)
Description: The printcenter function displays a string (string)
on the display screen row defined by (row) and
centered on the column defined by (col).
Return Value: No value is returned.
Example: The following program demonstrates the printcenter
function by centering a string on the top line of
the display screen.
/* printcenter demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
printcenter(1, 40, "This message is centered on
the top display line");
waitkey();
exit(0);
}
48 48
Functions
printone
-------------------------------------------------------------------
Summary: #include "extlib.h"
void printone(row, col, chr);
int row, col; (screen position)
int chr; (character)
Description: The printone function displays a character (chr) at
the display screen position defined by (row, col).
Return Value: No value is returned.
Example: The following program demonstrates the printone
function by displaying a Z at display screen
position (5, 40).
/* printone demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
printone(5, 40, 'Z');
waitkey();
exit(0);
}
49 49
Functions
printstring
-------------------------------------------------------------------
Summary: #include "extlib.h"
void printstring(row, col, string);
int row, col; (screen position)
char *string; (string pointer)
Description: The printstring function displays a string (string)
at the display screen position defined by (row,
col).
Return Value: No value is returned.
Example: The following program demonstrates the printstring
function by displaying a string at display screen
position (2, 10).
/* printstring demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
printstring(2, 10, "This message starts at
row 2, column 10");
waitkey();
exit(0);
}
50 50
Functions
pulldown
-------------------------------------------------------------------
Summary: #include "extlib.h"
int pulldown(row, number, menus, ikey, help);
int row; (menu bar row)
int number; (number of pull-down menus)
MENU_HEAD *menus; (pointer to an array of
MENU_HEAD structures)
int ikey; (initial key)
void (*help)(void); (overall help function
pointer)
Description: The pulldown function is used to implement multiple
pull-down menus. The number of pull-down menus is
defined by (number). The pulldown function
recognizes the following control keys:
====================================================
Control Key Action
----------------------------------------------------
ALT + Heading Hotkey Pulls down the indicated
menu.
ESC Removes the current menu
from the screen.
LEFT ARROW Removes the current menu
from the screen and pulls
down the next menu to the
left.
RIGHT ARROW Removes the current menu
from the screen and pulls
down the next menu to the
right.
Menu Item Hotkey Executes the selected menu
item's function.
ENTER Executes the highlighted
menu item's function.
F1 If a menu hasn't been
pulled down, executes the
overall help function
defined by (help).
Otherwise, executes the
highlighted menu item's
help function.
UP ARROW Moves the highlight bar up
to the previous menu item.
DOWN ARROW Moves the highlight bar
down to the next menu item.
====================================================
An initial key value can be sent to the pulldown
51 51
Functions
function by placing the appropriate value in (ikey).
Otherwise, (ikey) must equal zero to indicate no
initial key.
Return Value: If a menu item isn't selected, the pulldown function
returns the value of the last key pressed.
Otherwise, the pulldown function returns a value of
zero.
See Also: pulldown_bar
Example: The following program demonstrates how the pulldown
function is used to implement a series of pull-down
menus for a simple general ledger program.
/* pulldown/pulldown_bar demo */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "extlib.h"
void save_file(void);
void read_file(void);
void exit_prog(void);
void add_acc(void);
void del_acc(void);
void add_tra(void);
void del_tra(void);
void prt_coa(void);
void led_upd(void);
void fin_stat(void);
void read_func(void);
void sf_help(void);
void rf_help(void);
void aa_help(void);
void da_help(void);
void at_help(void);
void dt_help(void);
void pc_help(void);
void lu_help(void);
void fs_help(void);
void main_help(void);
static MENU file[3] = {
{"Save the File", 0, save_file, sf_help},
{"Read the File", 0, read_file, rf_help},
{"Exit the Program", 0, exit_prog, NULL} };
static MENU accounts[2] = {
{"Add an Account", 0, add_acc, aa_help},
52 52
Functions
{"Delete an Account", 0, del_acc, da_help} };
static MENU transact[2] = {
{"Add a Transaction", 0, add_tra, at_help},
{"Delete a Transaction", 0, del_tra,
dt_help} };
static MENU print[3] = {
{"Print a Chart of Accounts", 8, prt_coa,
pc_help},
{"Print a Ledger Update", 15, led_upd,
lu_help},
{"Print Financial Statements", 6, fin_stat,
fs_help} };
static MENU read[1] = {
{"", 0, read_func, NULL} };
static MENU_HEAD heads[5] = {
{"File", 0, 3, file},
{"Accounts", 0, 2, accounts},
{"Transactions", 0, 2, transact},
{"Print", 0, 3, print},
{"Read", 0, 1, read} };
void main(void)
{
save_initial_video();
setcurpos(15, 1);
cursoron();
pulldown_bar(1, 5, heads);
while (TRUE) {
int key = pulldown(1, 5, heads, 0,
main_help);
setcurpos(15, 1);
printf("%4d\n", key);
}
}
void save_file(void)
{
printcenter(19, 40, "Save File Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void read_file(void)
{
printcenter(19, 40, "Read File Function");
waitkey();
53 53
Functions
clearscreen(19, 1, 19, 80, 7);
}
void exit_prog(void)
{
exit(0);
}
void add_acc(void)
{
printcenter(19, 40, "Add Account Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void del_acc(void)
{
printcenter(19, 40, "Delete Account Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void add_tra(void)
{
printcenter(19, 40,
"Add Transaction Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void del_tra(void)
{
printcenter(19, 40,
"Delete Transaction Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void prt_coa(void)
{
printcenter(19, 40,
"Print Chart of Accounts Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void led_upd(void)
{
printcenter(19, 40,
"Ledger Update Function");
54 54
Functions
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void fin_stat(void)
{
printcenter(19, 40,
"Financial Statements Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void read_func(void)
{
printcenter(19, 40, "Read Test Function");
waitkey();
clearscreen(19, 1, 19, 80, 7);
}
void sf_help(void)
{
printcenter(20, 40, "Save File Help Function");
waitkey();
clearscreen(20, 1, 20, 80, 7);
}
void rf_help(void)
{
printcenter(20, 40, "Read File Help Function");
waitkey();
clearscreen(20, 1, 20, 80, 7);
}
void aa_help(void)
{
printcenter(20, 40,
"Add Account Help Function");
waitkey();
clearscreen(20, 1, 20, 80, 7);
}
void da_help(void)
{
printcenter(20, 40,
"Delete Account Help Function");
waitkey();
clearscreen(20, 1, 20, 80, 7);
}
void at_help(void)
55 55
Functions
{
printcenter(20, 40,
"Add Transaction Help Function");
waitkey();
clearscreen(20, 1, 20, 80, 7);
}
void dt_help(void)
{
printcenter(20, 40,
"Delete Transaction Help Function");
waitkey();
clearscreen(20, 1, 20, 80, 7);
}
void pc_help(void)
{
printcenter(20, 40,
"Print Chart of Accounts Help Function");
waitkey();
clearscreen(20, 1, 20, 80, 7);
}
void lu_help(void)
{
printcenter(20, 40,
"Ledger Update Help Function");
waitkey();
clearscreen(20, 1, 20, 80, 7);
}
void fs_help(void)
{
printcenter(20, 40,
"Financial Statements Help Function");
waitkey();
clearscreen(20, 1, 20, 80, 7);
}
void main_help(void)
{
printcenter(20, 40, "Main Help Function");
waitkey();
clearscreen(20, 1, 20, 80, 7);
}
56 56
Functions
pulldown_bar
-------------------------------------------------------------------
Summary: #include "extlib.h"
void pulldown_bar(row, number, menus);
int row; (menu bar row)
int number; (number of pull-down menus)
MENU_HEAD *menus; (pointer to an array of
MENU_HEAD structures)
Description: The pulldown_bar function is used to display a pull-
down menu bar on the line defined by (row).
Return Value: No value is returned.
See Also: pulldown
Example: For a demonstration of the pulldown_bar function,
see the pulldown function's example program.
57 57
Functions
readmouse
-------------------------------------------------------------------
Summary: #include "extlib.h"
void readmouse(void);
Description: The readmouse function determines the mouse's row
position, column position, left button status,
center button status, and right button status.
Return Value: No value is returned.
See Also: center_button, left_button, mouse_col, mouse_row,
and right_button
Example: The following program demonstrates the readmouse
function by continuously displaying the mouse's
current status.
/* readmouse demo */
#include <stdio.h>
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
do {
readmouse();
setcurpos(1, 1);
printf("Mouse Row: %3d\n", mouse_row);
printf("Mouse Column: %3d\n", mouse_col);
printf("Mouse Left Button Status: %d\n",
left_button);
printf("Mouse Center Button Status: %d\n",
center_button);
printf("Mouse Right Button Status: %d\n",
right_button);
} while (!keypressed()) ;
waitkey();
exit(0);
}
58 58
Functions
resetmouse
-------------------------------------------------------------------
Summary: #include "extlib.h"
void resetmouse(void);
Description: The resetmouse function resets the mouse driver.
Return Value: No value is returned.
Example: The following program demonstrates the resetmouse
function by resetting the mouse driver.
/* resetmouse demo */
#include <stdio.h>
#include <stdlib.h>
#include "extlib.h"
main()
{
settext80();
resetmouse();
showmouse();
do {
readmouse();
} while (!keypressed() && !left_button);
hidemouse();
if (keypressed())
waitkey();
exit(0);
}
59 59
Functions
restorescreen
-------------------------------------------------------------------
Summary: #include "extlib.h"
void restorescreen(row1, col1, row2, col2, buffer);
int row1, col1; (upper left corner of the
text window)
int row2, col2; (lower right corner of the
text window)
char *buffer; (buffer pointer)
Description: The restorescreen function displays a text window,
which has been previously saved in (buffer), at the
coordinates defined by (row1, col1) and (row2,
col2). Because each of the text window's characters
consists of a character/attribute pair, the buffer
must be ((row2 - row1 + 1) * (col2 - col1 + 1) * 2)
bytes long.
Return Value: No value is returned.
See Also: savescreen
Example: The following program demonstrates the restorescreen
function by displaying a previously saved text
window.
/* restorescreen demo */
#include <stdio.h>
#include <stdlib.h>
#include "extlib.h"
static char vbuff[4000];
main()
{
settext80();
savescreen(1, 1, 25, 80, vbuff);
clearscreen(1, 1, 25, 80, 7);
waitkey();
restorescreen(1, 1, 25, 80, vbuff);
waitkey();
exit(0);
}
60 60
Functions
save_initial_video
-------------------------------------------------------------------
Summary: #include "extlib.h"
void save_initial_video(void);
Description: The save_initial_video function is called at the
start of an application program to initialize the
Extended Library's operating environment., save the
cursor's position and type, save a copy of the
display screen, clear the display screen, turn off
the cursor, and turn on the mouse pointer. When the
application program is finished executing, the
save_initial_video function will automatically
restore the display screen's initial contents and
cursor settings.
Return Value: No value is returned.
See Also: settext80
Example: The following program demonstrates the
save_initial_video function by saving and restoring
the original screen contents.
/* save_initial_video demo */
#include <stdio.h>
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
printcenter(13, 40,
"This is a save_initial_video demo");
waitkey();
exit(0);
}
61 61
Functions
savescreen
-------------------------------------------------------------------
Summary: #include "extlib.h"
void savescreen(row1, col1, row2, col2, buffer);
int row1, col1; (upper left corner of the
text window)
int row2, col2; (lower right corner of the
text window)
char *buffer; (buffer pointer)
Description: The savescreen function saves the text window
defined by the coordinates (row1, col1) and (row2,
col2). Because each of the text window's characters
consists of a character/attribute pair, (buffer)
must be ((row2 - row1 + 1) * (col2 - col1 + 1) * 2)
bytes long.
Return Value: No value is returned.
See Also: restorescreen
Example: The following program demonstrates the savescreen
function by duplicating the left half of the display
screen onto the right half of the display screen.
/* savescreen demo */
#include <stdio.h>
#include <stdlib.h>
#include "extlib.h"
static char vbuff[2000];
main()
{
settext80();
savescreen(1, 1, 25, 40, vbuff);
restorescreen(1, 41, 25, 80, vbuff);
waitkey();
exit(0);
}
62 62
Functions
setattrib
-------------------------------------------------------------------
Summary: #include "extlib.h"
void setattrib(row1, col1, row2, col2, att);
int row1, col1; (upper left corner of the
text window)
int row2, col2; (lower right corner of the
text window)
int att; (text window attribute)
Description: The setattrib function sets an entire text window's
attributes to (att). The text window is defined by
the coordinates (row1, col1) and (row2, col2).
Return Value: No value is returned.
See Also: setone
Example: The following program demonstrates the setattrib
function by setting the right half of the display
screen to black characters on a white background.
/* setattrib demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
setattrib(1, 41, 25, 80, 0x70);
waitkey();
exit(0);
}
63 63
Functions
setcurpos
-------------------------------------------------------------------
Summary: #include "extlib.h"
void setcurpos(row, col);
int row, col; (cursor position)
Description: The setcurpos function moves the cursor to the
display screen position defined by (row, col).
Return Value: No value is returned.
Example: The following program demonstrates the setcurpos
function by moving the cursor to the right half of
the display screen's center line.
/* setcurpos demo */
#include <stdio.h>
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
setcurpos(13, 41);
printf("This message starts at the right half
of the center line");
waitkey();
exit(0);
}
64 64
Functions
setcursor
-------------------------------------------------------------------
Summary: #include "extlib.h"
void setcursor(sline, eline);
int sline; (cursor starting line)
int eline; (cursor ending line)
Description: The setcursor function sets the cursor character's
starting (sline) and ending (eline) lines.
Return Value: No value is returned.
Example: The following program demonstrates the setcursor
function by setting the cursor character to a
completely filled block.
/* setcursor demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
setcurpos(1, 1);
setcursor(0, 7);
cursoron();
waitkey();
exit(0);
}
65 65
Functions
setone
-------------------------------------------------------------------
Summary: #include "extlib.h"
void setone(row, col, att);
int row, col; (screen position)
int att; (attribute)
Description: The setone function sets the attribute for the
display screen position defined by (row, col) to
(att).
Return Value: No value is returned.
See Also: setattrib
Example: The following program demonstrates the setone
function by setting the attribute for position (23,
2) to a black character on a white background.
/* setone demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
setone(23, 2, 0x70);
waitkey();
exit(0);
}
66 66
Functions
settext80
-------------------------------------------------------------------
Summary: #include "extlib.h"
void settext80(void);
Description: The settext80 function initializes the Extended
Library's operating environment. The settext80
function should always be called before using any of
the Extended Library functions. (Note: The
settext80 function is automatically called by
save_initial_video; therefore, application programs
that call save_initial_video do not have to call
settext80.)
Return Value: No value is returned.
See Also: save_initial_video
Example: The following program demonstrates the settext80
function by initializing the Extended Library's
operating environment.
/* settext80 demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
settext80();
clearscreen(1, 1, 25, 80, 7);
setcurpos(1, 1);
waitkey();
exit(0);
}
67 67
Functions
showmouse
-------------------------------------------------------------------
Summary: #include "extlib.h"
void showmouse(void);
Description: The showmouse function turns on the mouse pointer.
Return Value: No value is returned.
See Also: hidemouse
Example: The following program demonstrates the showmouse
function by turning on the mouse pointer.
/* showmouse demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
hidemouse();
waitkey();
showmouse();
waitkey();
exit(0);
}
68 68
Functions
ssn_string
-------------------------------------------------------------------
Summary: #include "extlib.h"
char *ssn_string(string, number);
char *string; (storage location for the
Social Security number
string)
SSN *number; (Social Security number
structure)
Description: The ssn_string function constructs an 11-character
Social number string (string = "xxx-xx-xxxx") for
the Social Security number defined by (number).
Return Value: The ssn_string returns a pointer to the resulting
Social Security number string.
See Also: display_ssn and input_ssn
Example: The following program demonstrates the ssn_string
function by displaying a constructed Social Security
number string.
/* ssn_string demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
static SSN n = {007, 55, 3535};
char line[80];
save_initial_video();
printstring(10, 1, ssn_string(line, &n));
waitkey();
exit(0);
}
69 69
Functions
w_close
-------------------------------------------------------------------
Summary: #include "extlib.h"
WINDOW *w_close(window);
WINDOW *window; (window)
Description: The w_close function closes the previously opened
text window defined by (window).
Return Value: The w_close function returns a NULL pointer.
See Also: w_open
Example: The following program demonstrates the w_close
function by closing a text window at the coordinates
(1, 20) and (15, 50).
/* w_close demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
waitkey();
w = w_close(w);
exit(0);
}
70 70
Functions
w_clreol
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_clreol(window);
WINDOW *window; (window)
Description: The w_clreol function clears the current text window
line from the cursor's current column position to
the text window's right border. The text window is
defined by (window).
Return Value: No value is returned.
Example: The following program demonstrates the w_clreol
function by erasing a portion of a text window's top
line.
/* w_clreol demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
int i;
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
for (i = 0; i < 10; i++)
w_println(w, "This is another string");
waitkey();
w_setcurpos(w, 1, 2);
w_clreol(w);
waitkey();
w = w_close(w);
exit(0);
}
71 71
Functions
w_cls
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_cls(window);
WINDOW *window; (window)
Description: The w_cls function clears the text window defined by
(window).
Return Value: No value is returned.
Example: The following program demonstrates the w_cls
function by clearing the contents of a text window.
/* w_cls demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
int i;
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
for (i = 0; i < 10; i++)
w_println(w, "This is another string");
waitkey();
w_cls(w);
waitkey();
w = w_close(w);
exit(0);
}
72 72
Functions
w_draw
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_draw(row1, col1, row2, col2, watt, bflg);
int row1, col1; (upper left corner of the
text window)
int row2, col2; (lower right corner of the
text window)
int watt; (attribute)
int bflg; (border flag)
Description: The w_draw function draws the text window defined by
the coordinates (row1, col1) and (row2, col2) with
the attribute defined by (watt). The window's
border is defined by (bflg) as follows:
====================================================
Border Flag Action
----------------------------------------------------
NO_BORDER Draws the window without a
border.
SINGLE_LINE Draws a single-line border
around the window.
DOUBLE_LINE Draws a double-line border
around the window.
====================================================
Return Value: No value is returned.
See Also: w_open
Example: The following program demonstrates the w_draw
function by drawing a double-lined text window at
the coordinates (10, 30) and (15, 50).
/* w_draw demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
w_draw(10, 30, 15, 50, 0x70, DOUBLE_LINE);
waitkey();
exit(0);
}
73 73
Functions
w_horizontal_bar
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_horizontal_bar(window, curpos, total);
WINDOW *window; (window)
int curpos; (current line position)
int total; (line length);
Description: The w_horizontal_bar function draws a horizontal
scroll bar on the bottom of a text window (window).
The scroll bar setting is derived by dividing
(curpos) by (total).
Return Value: No value is returned.
See Also: w_vertical_bar
Example: The following program demonstrates the
w_horizontal_bar function by displaying a variety of
line positions.
/* w_horizontal_bar demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
int i;
WINDOW *w;
save_initial_video();
w = w_open(1, 30, 10, 70, 0x70, SINGLE_LINE);
w_horizontal_bar(w, 0, 100);
waitkey();
w_horizontal_bar(w, 50, 100);
waitkey();
w_horizontal_bar(w, 100, 100);
waitkey();
exit(0);
}
74 74
Functions
w_open
-------------------------------------------------------------------
Summary: #include "extlib.h"
WINDOW *w_open(row1, col1, row2, col2, watt,
[bflg, sflg]);
int row1, col1; (upper left corner of the
text window)
int row2, col2; (lower right corner of the
text window)
int watt; (window attribute)
int bflg; (border type flag)
int sflg; (scroll type flag)
Description: The w_open function defines and opens a text window
at the coordinates defined by (row1, col1) and
(row2, col2). Furthermore, the w_open function
defines the window's attributes (watt), border type
(btype), and scroll type (sflg). If (watt) is equal
to 0, the text window will not be drawn when it is
opened. The bflg parameter can be one of the
following constants:
====================================================
Constant Action
----------------------------------------------------
NO_BORDER When the window is opened,
it is drawn without a
border.
SINGLE_LINE When the window is opened,
it is drawn with a single-
lined border.
DOUBLE_LINE When the window is opened,
it is drawn with a double-
lined border.
====================================================
The sflg parameter can be one of the following
constants:
75 75
Functions
====================================================
Constant Action
----------------------------------------------------
SCROLL Scrolls text sent to the
window by the w_print,
w_printat, w_printf,
w_println, and w_printlnat
functions.
NO_SCROLL Truncates text sent to the
window by the w_print,
w_printat, w_printf,
w_println, and w_printlnat
functions.
====================================================
Return Value: The w_open function returns a structure pointer of
type WINDOW.
See Also: w_close and w_draw
Example: The following program demonstrates the w_open
function by opening and drawing a text window at the
coordinates (1, 20) and (15, 50).
/* w_open demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
waitkey();
w = w_close(w);
exit(0);
}
76 76
Functions
w_print
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_print(window, string);
WINDOW *window; (window)
char *string; (string pointer)
Description: The w_print function displays a (string) at a text
window's (window) current cursor position.
Return Value: No value is returned.
See Also: w_printat, w_printf, w_println, and w_printlnat
Example: The following program demonstrates the w_print
function by displaying an assortment of strings in a
text window.
/* w_print demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
w_print(w, "This is message 1");
w_print(w, "This is message 2");
w_print(w, "This is message 3");
waitkey();
w = w_close(w);
exit(0);
}
77 77
Functions
w_printat
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_printat(window, row, col, string);
WINDOW *window; (window)
int row, col; (screen position)
char *string; (string pointer)
Description: The w_printat function displays a (string) at the
text window (window) position defined by (row, col).
Return Value: No value is returned.
See Also: w_print, w_printf, w_println, and w_printlnat
Example: The following program demonstrates the w_printat
function by displaying an assortment of strings in a
text window.
/* w_printat demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
w_printat(w, 3, 1, "This is message 1");
w_printat(w, 2, 1, "This is message 2");
w_printat(w, 5, 1, "This is message 3");
waitkey();
w = w_close(w);
exit(0);
}
78 78
Functions
w_printf
-------------------------------------------------------------------
Summary: #include "extlib.h"
int w_printf(window, row, col, format, ...);
WINDOW *window; (window)
int row, col; (screen position)
char *format; (format string)
Description: The w_printf function displays a printf at the text
window (window) position defined by (row, col).
Return Value: The w_printf function returns the length of the
displayed string.
See Also: w_print, w_printat, w_println, and w_printlnat
Example: The following program demonstrates the w_printf
function by displaying a formatted string at the top
line of a text window.
/* w_printf demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
w_printf(w, 1, 1, "This is line # %d", 1);
waitkey();
w = w_close(w);
exit(0);
}
79 79
Functions
w_println
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_println(window, string);
WINDOW *window; (window)
char *string; (string pointer)
Description: The w_println function displays a (string) and a
carriage return at a text window's (window) current
cursor position.
Return Value: No value is returned.
See Also: w_print, w_printat, w_printf, and w_printlnat
Example: The following program demonstrates the w_println
function by displaying an assortment of strings in a
text window.
/* w_println demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
w_println(w, "This is message 1");
w_println(w, "This is message 2");
w_println(w, "This is message 3");
waitkey();
w = w_close(w);
exit(0);
}
80 80
Functions
w_printlnat
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_printlnat(window, row, col, string);
WINDOW *window; (window)
int row, col; (screen position)
char *string; (string pointer)
Description: The w_printlnat function displays a (string) and a
carriage return at the text window (window) position
defined by (row, col).
Return Value: No value is returned.
See Also: w_print, w_printat, w_printf, and w_println
Example: The following program demonstrates the w_printlnat
function by displaying an assortment of strings in a
text window.
/* w_printlnat demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
w_printlnat(w, 3, 1, "This is message 1");
w_printlnat(w, 2, 1, "This is message 2");
w_printlnat(w, 5, 1, "This is message 3");
waitkey();
w = w_close(w);
exit(0);
}
81 81
Functions
w_scroll
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_scroll(window, nlines, direction, cflag);
WINDOW *window; (window)
int nlines; (number of lines to scroll)
int direction; (scroll direction)
int cflag; (clear lines flag)
Description: The w_scroll function scrolls the contents of the
text window defined by (window). If (cflag) is TRUE
(1), the (nlines) at the beginning of the scroll are
cleared. Otherwise, the beginning scroll lines are
left intact. The (direction) parameter can be one
of the following constants (defined in extlib.h):
====================================================
Constant Action
----------------------------------------------------
UP Scroll the text window's
contents up (nlines).
DOWN Scroll the text window's
contents down (nlines).
LEFT Scroll the text window's
contents left (nlines).
RIGHT Scroll the text window's
contents right (nlines).
====================================================
Return Value: No value is returned.
Example: The following program demonstrates the w_scroll
function by performing a variety of scroll
operations.
/* w_scroll demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
int i;
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
for (i = 0; i < 10; i++)
w_println(w, "This is another string");
waitkey();
w_scroll(w, 1, UP, CLEAR);
82 82
Functions
waitkey();
w_scroll(w, 1, DOWN, CLEAR);
waitkey();
w_scroll(w, 1, LEFT, CLEAR);
waitkey();
w_scroll(w, 1, RIGHT, CLEAR);
waitkey();
w = w_close(w);
exit(0);
}
83 83
Functions
w_setcurpos
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_setcurpos(window, row, col);
WINDOW *window; (window)
int row, col; (text window position)
Description: The w_setcurpos function moves the cursor to the
text window position defined by (row, col). The
text window is defined by (window).
Return Value: No value is returned.
Example: The following program demonstrates the w_setcurpos
function by moving the cursor to a variety of
positions.
/* w_setcurpos demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
WINDOW *w;
save_initial_video();
w = w_open(1, 20, 15, 50, 0x70, SINGLE_LINE);
cursoron();
waitkey();
w_setcurpos(w, 10, 5);
waitkey();
w_setcurpos(w, 6, 7);
waitkey();
w = w_close(w);
exit(0);
}
84 84
Functions
w_vertical_bar
-------------------------------------------------------------------
Summary: #include "extlib.h"
void w_vertical_bar(window, curpos, total);
WINDOW *window; (window)
int curpos; (current file position)
int total; (file length);
Description: The w_vertical_bar function draws a vertical scroll
bar on the right side of a text window (window).
The scroll bar setting is derived by dividing
(curpos) by (total).
Return Value: No value is returned.
See Also: w_horizontal_bar
Example: The following program demonstrates the
w_vertical_bar function by displaying a variety of
file positions.
/* w_vertical_bar demo */
#include <stdlib.h>
#include "extlib.h"
main()
{
int i;
WINDOW *w;
save_initial_video();
w = w_open(1, 30, 10, 70, 0x70, SINGLE_LINE);
w_vertical_bar(w, 0, 100);
waitkey();
w_vertical_bar(w, 50, 100);
waitkey();
w_vertical_bar(w, 100, 100);
waitkey();
exit(0);
}
85 85
Functions
waitkey
-------------------------------------------------------------------
Summary: #include "extlib.h"
int waitkey(void);
Description: The waitkey function waits for the operator to press
a key.
Return Value: The waitkey function returns the ASCII code for all
nonextended-keyboard keys. Extended-keyboard keys
return a value of their scan code + 256.
See Also: keypressed
Example: The following program demonstrates the waitkey
function by returning the values for an assortment
of key presses. Program execution will continue
until the <ESC> key is pressed.
/* waitkey demo */
#include <stdio.h>
#include <stdlib.h>
#include "extlib.h"
main()
{
int key;
save_initial_video();
while (TRUE) {
if ((key = waitkey()) == 27)
exit(0);
printf("%d\n", key);
}
}
86 86
Functions
wprintf
-------------------------------------------------------------------
Summary: #include "extlib.h"
int wprintf(row, col, format, ...);
int row, col; (screen position)
char *format; (format string)
Description: The wprintf function performs a printf at the
display screen position defined by (row, col).
Return Value: The wprintf function returns the length of the
displayed string.
See Also: w_printf
Example: The following program demonstrates the wprintf
function by displaying a formatted string on the top
line of the display screen.
/* wprintf demo */
#include <stdio.h>
#include <stdlib.h>
#include "extlib.h"
main()
{
save_initial_video();
wprintf(1, 40, "This string starts at %d,%d.",
1, 40);
waitkey();
exit(0);
}
87 87
Registration
Registration
Registration licenses you to use Extended Library 2.0, and all
future 2.x updates. Any unregistered use other than trial use to
determine if Extended Library meets your needs is a violation of
our license agreement and is forbidden.
Single user registration is available for $20.00 per copy.
Registered users will be sent the most current version of Extended
Library. This includes all 16 versions of the library and the
complete source code. Registration also entitles you to free
telephone support and discounts on future versions of Extended
Library.
The Extended Library license authorizes the use of one copy of
Extended Library on one machine at a time. If you have multiple
computers, either standalone, networked, or multi-user, you need to
register one copy of Extended Library for each workstation on which
it will be used.
88 88
Invoice
Maine Data and Financial Systems, Inc.
HCR 79 Box 103
Orland, ME 04472
(207) 469-7027
Quantity Description Amount
________ Extended Library 2.0 Registration @ $20.00 ________
Registration is for each computer or
workstation on which Extended Library will be
used.
Subtotal ________
Maine Residents add 5% sales tax ________
Total ________
Name: _____________________________________________________
Company: _____________________________________________________
Address: _____________________________________________________
_____________________________________________________
_____________________________________________________
Phone: _____________________________________________________
THANK YOU FOR YOUR ORDER